package cn.com.yang.thread;

import java.util.Date;

public class MyRunnable implements Runnable {
	
	int pauseTime;
	String threadName;
	public static int ANT=100;
	public MyRunnable(int pauseTime,String threadName) {
		this.pauseTime = pauseTime;
		this.threadName = threadName;
	}
	public void run() {
		while(true) {
			System.out.println(threadName + ":" + new Date(System.currentTimeMillis()));
			try {
				Thread.sleep(pauseTime);
				System.out.print(MyRunnable.ANT);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			
		}
	}
	public static void main(String[] args) {
		MyRunnable  r1 = new MyRunnable(1000,"Fast");
		Thread t1 = new Thread(r1);
		t1.start();
		Thread t2 = new Thread(r1);
		t2.start();
		
		MyRunnable  r2 = new MyRunnable(3000,"Slow");
		Thread t3 = new Thread(r2);
		t3.start();
		Thread t4 = new Thread(r2);
		t4.start();
	}

}
